const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = {
  // pages, // 多页面开关
  parallel: false,
  outputDir: "./dist",
  publicPath: process.env.NODE_ENV === "production" ? "./" : "/",
  assetsDir: "./assets",
  lintOnSave: false,
  chainWebpack: (config) => {
    // 修复HMR
    config.resolve.symlinks(true);
    config.resolve.alias
      .set("@", resolve("src"))
      .set("tim", resolve("src/utils/trtc-calling/imConfig/index.js"));
    // 删除预加载
    config.plugins.delete("preload");
    config.plugins.delete("prefetch");
    // 压缩代码
    config.optimization.minimize(true);
    // 分割代码
    config.optimization.splitChunks({
      chunks: "all",
    });
  },
};
